package com.itheima.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.health.service.CheckItemService;
import com.itheima.constant.MessageConstant;
import com.itheima.entity.Result;
import com.itheima.pojo.CheckItem;
import org.springframework.web.bind.annotation.*;

@RequestMapping("/checkItem")
@RestController
public class CheckItemController {
    @Reference
    private CheckItemService checkItemService;

    @PostMapping("/add")
    public Result add(@RequestBody CheckItem checkItem){
        try{
            checkItemService.add(checkItem);
        }catch (Exception e){
            e.printStackTrace();
            //服务调用失败
            return new Result(false, MessageConstant.ADD_CHECKITEM_FAIL);
        }
        return  new Result(true, MessageConstant.ADD_CHECKITEM_SUCCESS);
    }
}
